
#include <iostream>
#include "log_service.h"

int main()
{
    // create service with string list
    // int ret = LogService::init({"file", "color", "udp", "stdout"});

    // create service with enumerated log types
    int ret = LogService::init({LogService::FILE_LOG, LogService::COLOR_LOG});

    if (ret != 0) {
        std::cerr << "init log service failed" << std::endl;
        return -1;
    }

    // create logger with enumerated level
    // auto logger = LogService::create("main", spdlog::level::level_enum::trace);

    // create logger with default level(info)
    auto logger = LogService::create("main");

    // create logger with string level
    // auto logger = LogService::create("main", "debug");

    if (!logger) {
        std::cerr << "create logger failed" << std::endl;
        return -1;
    }

    logger->critical("{} + {} = {}", 1, 2, 1 + 2);
    logger->error("{} + {} = {}", 1, 2, 1 + 2);
    logger->warn("{} + {} = {}", 1, 2, 1 + 2);
    logger->info("{} + {} = {}", 1, 2, 1 + 2);
    logger->debug("{} + {} = {}", 1, 2, 1 + 2);
    logger->trace("{} + {} = {}", 1, 2, 1 + 2);

    return 0;
}
